package com.pansoft.openplanet.constant;

/**
 * 星际资产常量
 */
public class IPAssetsConstant {

    public static String EOSCONTRACT = "eosio.token";
    public static String OCTCONTRACT = "octtothemoon";//erctoken
    public static String ACTIONTRANSFER = "transfer";
    public static String PERMISSONION = "active";
    public static String OCTASKANSCONTRACT = "ocaskans";//erctoken
    public static String ACTIONAPPROVE = "approve";//授权可转走（押币）
    public static String ACTIONASK = "ask";//押币后提问
    public static String ACTIONANSWER = "answer";//押币后回答问题
    public static String REDPACKETACCOUNT = "eosredpacket";//红包管理账号


    /**
     * 链编号
     */
    //比特币
    public static final int CHAIN_ID_BTC = 1;
    //以太坊
    public static final int CHAIN_ID_ETH = 2;
    //eos
    public static final int CHAIN_ID_EOS = 3;
    //能量币
    public static final int CHAIN_ID_TURBOCHAIN = 4;
    //eos 测试
    public static final int CHAIN_ID_EOSTEST = 5;
    //Achain
    public static final int CHAIN_ID_ACT = 6;
    //bch
    public static final int CHAIN_ID_BCH = 7;
    //ete
    public static final int CHAIN_ID_ETE = 0x88;

    public enum ChainEnum {
        ETH("ETH", CHAIN_ID_ETH),
        BTC("BTC", CHAIN_ID_BTC),
        EOS("EOS", CHAIN_ID_EOS),
        TURBOCHAIN("TURBOCHAIN", CHAIN_ID_TURBOCHAIN),
        EOSTEST("EOSTEST", CHAIN_ID_EOSTEST),
        ACHAIN("ACHAIN", CHAIN_ID_ACT),
        BCH("BCH", CHAIN_ID_BCH),
        ETE("ETE", CHAIN_ID_ETE);


        public String chainName;
        public int chainId;

        ChainEnum(String chainName, int chainId) {
            this.chainName = chainName;
            this.chainId = chainId;
        }

        public static ChainEnum getChainEnumByChainId(int chainId) {
            for (ChainEnum item : ChainEnum.values()) {
                if (item.chainId == chainId) {
                    return item;
                }
            }
            return null;
        }

        public static ChainEnum getChainEnumByChainName(String chainName) {
            for (ChainEnum item : ChainEnum.values()) {
                if (item.chainName.equals(chainName)) {
                    return item;
                }
            }
            return null;
        }
    }
}
